package org.spring.sample.common.sluth.server;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import lombok.extern.slf4j.Slf4j;
@RestController
@SpringBootApplication
@Slf4j
public class Slueth_8989_App {

	@Autowired
	private RestTemplate restTemplate;

	@Bean
	public RestTemplate getRestTemplate() {
		return new RestTemplate();
	}

	@GetMapping(value = "/index")
	public String index() {
		log.info("8989服务调用8988的服务");
		return restTemplate.getForObject("http://localhost:8988/show", String.class);
	}
	
	
	@GetMapping(value="/show")
	public String show() {
		return "89服务";
	}
	
	public static void main(String[] args) {
		SpringApplication.run(Slueth_8989_App.class, args);
	}
}
